(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
"use strict";

Object.defineProperty(exports, "__esModule", {
	value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var AppClass = function () {
	function AppClass() {
		_classCallCheck(this, AppClass);

		this._eventContext = null;
		this._loadingPanel = null;
		this._pages = [];
		this._routes = [];
		this._user = null;
	}

	_createClass(AppClass, [{
		key: "login",
		value: function login(user) {
			this._user = Object.assign({}, user);
		}
	}, {
		key: "crudGridInstance",
		value: function crudGridInstance() {
			return $(".crud-grid").dxDataGrid("instance");
		}
	}, {
		key: "getFormInstance",
		value: function getFormInstance() {
			return $("#form").dxForm("instance");
		}
	}, {
		key: "getEventContext",
		value: function getEventContext() {
			return this._eventContext;
		}
	}, {
		key: "setEventContext",
		value: function setEventContext(v) {
			this._eventContext = v;
		}
	}, {
		key: "showLoading",
		value: function showLoading(message) {
			message = message || '正在加载...';

			this._loadingPanel = $("#loadpanel").dxLoadPanel({
				shadingColor: "rgba(0,0,0,0.4)",
				position: { of: "body" },
				visible: true,
				showIndicator: true,
				showPane: true,
				shading: true,
				closeOnOutsideClick: false,
				message: message
			}).dxLoadPanel("instance");
		}
	}, {
		key: "hideLoading",
		value: function hideLoading() {
			if (this._loadingPanel !== null) {
				this._loadingPanel.hide();
				this._loadingPanel = null;
			}
		}
	}, {
		key: "registerCrud",
		value: function registerCrud(opt) {
			this.pages.push(opt);
		}
	}, {
		key: "registerRoute",
		value: function registerRoute(opt) {
			this.routes.push(opt);
		}
	}, {
		key: "pages",
		get: function get() {
			return this._pages;
		}
	}, {
		key: "routes",
		get: function get() {
			return this._routes;
		}
	}, {
		key: "user",
		get: function get() {
			return this._user;
		}
	}]);

	return AppClass;
}();

var App = exports.App = new AppClass();


},{}],2:[function(require,module,exports){
'use strict';

var _app = require('./app');

var _util = require('./util');

var _util2 = _interopRequireDefault(_util);

var _page = require('./page');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

_app.App.registerCrud({
	route: 'goodcategory', //路由名称
	url: $.config('apiUrl') + 'good-category',
	title: '商品分类', //分页标题
	capable: {
		create: true
	},
	columns: [{
		dataField: 'code',
		caption: '商品编码'
	}, {
		dataField: 'name',
		caption: '商品分类名称' //名称
	}, {
		minWidth: 120,
		caption: '操作',
		buttons: [{
			title: '编辑',
			url: '#/goodcategory/edit/{{id}}' //#/路由名称/edit/{{id}}
		}]
	}],
	form: {
		readOnly: false,
		showColonAfterLabel: true,
		showValidationSummary: false,
		colCount: 1,
		beforeSubmit: function beforeSubmit(form, id) {
			form.option('formData', Object.assign({ type: 'admin' }, form.option('formData')));

			return true;
		},
		items: [{
			dataField: 'name',
			label: { text: '商品分类名称' },
			validationRules: [{ type: "required" }]
		}, {
			dataField: 'code',
			label: { text: '商品编码' },
			validationRules: [{ type: "required" }]
		}]
	}
});

_app.App.registerCrud({
	route: 'projecttype', //路由名称
	url: $.config('apiUrl') + 'project-type',
	title: '项目类型', //分页标题
	capable: {
		create: true
	},
	columns: [{
		dataField: 'code',
		caption: '项目类型编号'
	}, {
		dataField: 'name',
		caption: '项目类型名称' //名称
	}, {
		minWidth: 120,
		caption: '操作',
		buttons: [{
			title: '编辑',
			url: '#/projecttype/edit/{{id}}' //#/路由名称/edit/{{id}}
		}]
	}],
	form: {
		readOnly: false,
		showColonAfterLabel: true,
		showValidationSummary: false,
		colCount: 1,
		beforeSubmit: function beforeSubmit(form, id) {
			form.option('formData', Object.assign({ type: 'admin' }, form.option('formData')));

			return true;
		},
		items: [{
			dataField: "code",
			validationRules: [{ type: "required" }],
			label: { text: '项目类型编号' //名称
			} }, {
			dataField: 'name',
			label: { text: '项目类型名称' },
			validationRules: [{ type: "required" }]
		}]
	}
});

_app.App.registerCrud({
	route: 'site', //路由名称
	url: $.config('apiUrl') + 'site',
	title: '场地类型', //分页标题
	capable: {
		create: true
	},
	columns: [{
		dataField: 'code',
		caption: '场地类型编号'
	}, {
		dataField: 'name',
		caption: '场地类型名称' //名称
	}, {
		minWidth: 120,
		caption: '操作',
		buttons: [{
			title: '编辑',
			url: '#/site/edit/{{id}}' //#/路由名称/edit/{{id}}
		}]
	}],
	form: {
		readOnly: false,
		showColonAfterLabel: true,
		showValidationSummary: false,
		colCount: 1,
		beforeSubmit: function beforeSubmit(form, id) {
			form.option('formData', Object.assign({ type: 'admin' }, form.option('formData')));

			return true;
		},
		items: [{
			dataField: "code",
			validationRules: [{ type: "required" }],
			label: { text: '场地类型编号' //名称
			} }, {
			dataField: 'name',
			label: { text: '场地类型名称' },
			validationRules: [{ type: "required" }]
		}]
	}
});

_app.App.registerCrud({
	route: 'laborrelation', //路由名称
	url: $.config('apiUrl') + 'labor-relation',
	title: '劳务关系', //分页标题
	capable: {
		create: true
	},
	columns: [{
		dataField: 'code',
		caption: '编号'
	}, {
		dataField: 'name',
		caption: '名称' //名称
	}, {
		minWidth: 120,
		caption: '操作',
		buttons: [{
			title: '编辑',
			url: '#/laborrelation/edit/{{id}}' //#/路由名称/edit/{{id}}
		}]
	}],
	form: {
		readOnly: false,
		showColonAfterLabel: true,
		showValidationSummary: false,
		colCount: 1,
		beforeSubmit: function beforeSubmit(form, id) {
			form.option('formData', Object.assign({ type: 'admin' }, form.option('formData')));

			return true;
		},
		items: [{
			dataField: "code",
			validationRules: [{ type: "required" }],
			label: { text: '编号' //名称
			} }, {
			dataField: 'name',
			label: { text: '名称' },
			validationRules: [{ type: "required" }]
		}]
	}
});

_app.App.registerCrud({
	route: 'module', //路由名称
	url: $.config('apiUrl') + 'module',
	title: '功能模块', //分页标题
	capable: {
		create: true
	},
	columns: [{
		dataField: 'code',
		caption: '程序识别编码'
	}, {
		dataField: 'name',
		caption: '名称' //名称
	}, {
		minWidth: 120,
		caption: '操作',
		buttons: [{
			title: '编辑',
			url: '#/module/edit/{{id}}' //#/路由名称/edit/{{id}}
		}]
	}],
	form: {
		readOnly: false,
		showColonAfterLabel: true,
		showValidationSummary: false,
		colCount: 1,
		beforeSubmit: function beforeSubmit(form, id) {
			form.option('formData', Object.assign({ type: 'admin' }, form.option('formData')));

			return true;
		},
		items: [{
			dataField: "code",
			validationRules: [{ type: "required" }],
			label: { text: '程序识别编码' //名称
			} }, {
			dataField: 'name',
			label: { text: '名称' },
			validationRules: [{ type: "required" }]
		}]
	}
});

_app.App.registerCrud({
	route: 'roomtype', //路由名称
	url: $.config('apiUrl') + 'room-type',
	title: '房间模块', //分页标题
	capable: {
		create: true
	},
	columns: [{
		dataField: 'code',
		caption: '编号'
	}, {
		dataField: 'name',
		caption: '名称' //名称
	}, {
		minWidth: 120,
		caption: '操作',
		buttons: [{
			title: '编辑',
			url: '#/roomtype/edit/{{id}}' //#/路由名称/edit/{{id}}
		}]
	}],
	form: {
		readOnly: false,
		showColonAfterLabel: true,
		showValidationSummary: false,
		colCount: 1,
		beforeSubmit: function beforeSubmit(form, id) {
			form.option('formData', Object.assign({ type: 'admin' }, form.option('formData')));

			return true;
		},
		items: [{
			dataField: "code",
			validationRules: [{ type: "required" }],
			label: { text: '编号' //名称
			} }, {
			dataField: 'name',
			label: { text: '名称' },
			validationRules: [{ type: "required" }]
		}]
	}
});

_app.App.registerCrud({
	route: 'status', //路由名称
	url: $.config('apiUrl') + 'status',
	title: '状态模块', //分页标题
	capable: {
		create: true
	},
	columns: [{
		dataField: 'code',
		caption: '程序识别编码'
	}, {
		dataField: 'name',
		caption: '名称' //名称
	}, {
		minWidth: 120,
		caption: '操作',
		buttons: [{
			title: '编辑',
			url: '#/status/edit/{{id}}' //#/路由名称/edit/{{id}}
		}]
	}],
	form: {
		readOnly: false,
		showColonAfterLabel: true,
		showValidationSummary: false,
		colCount: 1,
		beforeSubmit: function beforeSubmit(form, id) {
			form.option('formData', Object.assign({ type: 'admin' }, form.option('formData')));

			return true;
		},
		items: [{
			dataField: "code",
			label: { text: '程序识别编码' //名称
			} }, {
			dataField: 'name',
			label: { text: '名称' },
			validationRules: [{ type: "required" }]
		}]
	}
});


},{"./app":1,"./page":3,"./util":4}],3:[function(require,module,exports){
"use strict";

Object.defineProperty(exports, "__esModule", {
	value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var Page = exports.Page = function () {
	function Page($container) {
		_classCallCheck(this, Page);

		this.$container = $container;
		this.$content = $container;
	}

	_createClass(Page, [{
		key: "crudLayout",
		value: function crudLayout(opt) {
			var data = Object.assign({ title: '未设置' }, opt),
			    html = "<div class=\"app-content-body \">\n\t\t  <div class=\"bg-light lter b-b wrapper-md hidden-print\">\n\t\t    <h1 class=\"m-n font-thin h3\">{{title}}</h1>\n\t\t  </div>\n\t\t  <div>\n\t\t    <div class=\"crud-container crud-reset\">\n\t\t    </div>\n\t\t  </div>\n\t\t</div>";

			this.$container.html(Mustache.render(html, data));
			this.$content = this.$container.find(".crud-container");

			return this;
		}
	}, {
		key: "content",
		get: function get() {
			return this.$content;
		}
	}]);

	return Page;
}();


},{}],4:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
	value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var Util = function () {
	function Util() {
		_classCallCheck(this, Util);
	}

	_createClass(Util, [{
		key: 'formatXbm',
		value: function formatXbm(xbm) {
			if (xbm == '2') return '女';else if (xbm == '1') return '男';else return xbm;
		}
	}, {
		key: 'crudStore',
		value: function crudStore(url, options) {

			var SERVICE_URL = url;
			options = $.extend({
				onDataArrived: function onDataArrived(data) {
					return data;
				}
			}, options);

			return new DevExpress.data.CustomStore($.extend({}, options, {

				load: function load(loadOptions) {

					var u = new Url(SERVICE_URL);

					u.query._param = JSON.stringify(loadOptions);

					return $.getJSON(u).then(function (resp, status, xhr) {

						if (resp.success) {
							resp = {
								status: 'success',
								data: resp.items
							};
						} else {
							resp = {
								status: 'success',
								totalCount: resp.totalCount,
								data: resp.data
							};
						}

						return options.onDataArrived(resp);
					});
				},

				byKey: function byKey(key) {
					var u = new Url(SERVICE_URL);
					u.path += "/" + encodeURIComponent(key);

					return $.getJSON(u).then(function (resp) {
						return resp;
					});
				},

				insert: function insert(values) {
					return $.post(SERVICE_URL, values).always(function (resp) {
						$.crudStoreResp = resp.responseJSON;
						return resp;
					});
				},

				update: function update(key, values) {
					var u = new Url(SERVICE_URL);
					u.path += "/" + encodeURIComponent(key);

					return $.ajax({
						url: u,
						method: "PUT",
						data: values
					}).always(function (resp) {
						$.crudStoreResp = resp.responseJSON;
						return resp;
					});
				},

				remove: function remove(key) {
					var u = new Url(SERVICE_URL);
					u.path += "/" + encodeURIComponent(key);

					return $.ajax({
						url: u,
						method: "DELETE"
					});
				}

			}));
		}
	}, {
		key: 'postForm',
		value: function postForm(url, data) {
			return $.ajax({
				url: url,
				data: JSON.stringify(data),
				contentType: "application/json",
				dataType: 'json',
				type: 'post'
			});
		}
	}]);

	return Util;
}();

exports.default = new Util();


},{}]},{},[2]);
